package jd;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int q = sc.nextInt();
        while (sc.hasNextInt()) {
            int n = sc.nextInt();
            int m = sc.nextInt();
            int k = sc.nextInt();

            int minValue = n<=m ? n : m;
            int maxValue = n==minValue ? n : m;
            if (minValue + (maxValue-minValue) >= k) {
                System.out.println(-1);
                return;
            }
            if ((n%2==0 && m%2==0) || (m%2==1 && n%2==1)) {
                System.out.println(k-2);
            } else {
                System.out.println(k-1);
            }
        }
    }


}
